package com.demo.thread.service;


import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

@Slf4j
@Service
public class TestTheadService {

    public void testThread(){
        for (int i = 0; i < 1000; i++) {
            int finalI = i;
            new Thread(()->{
                log.info("{} 接受到请求:num={}", Thread.currentThread().getName(), finalI);
            });
            try {
                TimeUnit.HOURS.sleep(1);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
